﻿
package extremefx.storage {
	import flash.net.SharedObject;
	import flash.utils.Timer;
	import flash.events.TimerEvent;
	/**
	 * @author Marcelo Volmaro
	 */
	public class Cookie {
		private var _obj:SharedObject;
		private var _sint:Timer;

		public function Cookie() {
			_sint = new Timer(500, 1);
			_sint.addEventListener("timer", _save, false, 0, true);
		}
		
		protected final function _init(pPath:String):void{
			_obj = SharedObject.getLocal(pPath, "/");
		}
		
		protected final function save():void{
			_sint.start();
		}
		
		private function _save(event:TimerEvent):void{
			_obj.flush();
		}
	}
}
